package com.mingqijia.gassafety.db.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.mingqijia.gassafety.db.entity.CmStatDevice;
import com.mingqijia.gassafety.db.entity.vo.PlatformBrandDetailResp;
import com.mingqijia.gassafety.db.entity.vo.PlatformEquipmentResp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
@DS("db7")
public interface CmStatDeviceMapper extends BaseMapper<CmStatDevice> {
    /**
     * 根据SPID查询平台品牌厂家
     * @param spIds
     */
    List<PlatformBrandDetailResp> selectPlatformBrandBySpId(@Param("spIds") List<String> spIds);

    /**
     * 查询所有平台品牌厂家
     */
    List<PlatformBrandDetailResp> selectPlatformBrand();

    /**
     * 根据SPID查询平台设备品类
     * @param spIds
     */
    List<PlatformEquipmentResp> selectPlatformEquipmentBySpId(@Param("spIds") List<String> spIds);

    /**
     * 查询所有平台设备品类
     */
    List<PlatformEquipmentResp> selectPlatformEquipment();

    /**
     * 批量插入数据
     * @param datas
     */
    void insertBatch(@Param("datas") List<CmStatDevice> datas);

    /**
     * 获取指定条件的最后一条更新记录
     * @param spId
     * @param esCode
     * @param deviceType
     * @return
     */
    List<CmStatDevice> selectLastStatDeviceStatus(@Param("spId") String spId,
                                                  @Param("esCode") String esCode,
                                                  @Param("deviceType") String deviceType);

    /**
     * 根据SPID查询平台设备
     * @param spIds
     */
    List<CmStatDevice> selectPlatformImeiBySpId(@Param("spIds") List<String> spIds);

    /**
     * 根据SPID查询平台设备
     * @param spIds
     */
    List<CmStatDevice> selectPlatformImeiSumBySpId(@Param("spIds") List<String> spIds);
}
